<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台管理系统</title>
    <meta name="author" content="BaiYY"/>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="renderer" content="webkit">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/Font/css/font-awesome.min.css"/>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/index.css"/>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/pages.css"/>
    <script type="text/javascript" src="__PUBLIC__/admin/js/jquery.js"></script>
    <script type="text/javascript" src="__PUBLIC__/admin/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/admin/js/index.js"></script>
    <script type="text/javascript" src="__PUBLIC__/admin/js/time.js"></script>
    <script type="text/javascript" src="__PUBLIC__/admin/js/pages.js"></script>
</head>
<body>
    <div class="right-sidebar" style="max-width: 1200px;position: relative">
        <ul class="nav nav-tabs" style="margin-bottom: 16px" role="tablist">
            <li role="presentation" class="active"><a href="feedBack.html">反馈列表</a></li>
            <li role="presentation"><a href="feedBackLists.html">解决列表</a></li>
        </ul>
        <div id="tabTab">
            <section class="table-responsive" >
                <table class="table table-bordered">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>类型</th>
                        <th>玩家ID</th>
                        <th>玩家昵称</th>
                        <th>内容</th>
                        <th>反馈时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody id="dataList"></tbody>
                </table>
            </section>
            <div style="width: 100%;">
                <ul class="page" id="page" style="width: 100%;overflow: hidden;"></ul>
            </div>
        </div>
        <div id="panel" style="display: none">
            <div class="input-group">
                <span class="input-group-addon">ID&emsp;&emsp;&emsp;</span>
                <input type="text" class="form-control" name="ids" id="ids" disabled="true">
            </div>
            <div class="input-group">
                <span class="input-group-addon">类型&emsp;&emsp;</span>
                <input type="text" class="form-control" name="classs" id="classs" disabled="true">
            </div>
            <div class="input-group">
                <span class="input-group-addon">玩家ID&emsp;</span>
                <input type="text" class="form-control" name="uidd" id="uidd" disabled="true">
            </div>
            <div class="input-group">
                <span class="input-group-addon">玩家昵称</span>
                <input type="text" class="form-control" name="uname" id="uname" disabled="true">
            </div>
            <div class="input-group">
                <span class="input-group-addon">反馈时间</span>
                <input type="text" class="form-control" name="time" id="time" disabled="true">
            </div>
            <div class="input-group">
                <span class="input-group-addon">反馈内容</span>
                <textarea class="form-control" name="contents" id="contents" cols="40" rows="20">不能居中的罪魁祸首是 col-sm-* 的 float: left 样式，因为对于 col-sm-* 而言，只要屏幕宽度不小于 @screen-sm-min 就不会折行，所以可以考虑不使用 float: left 而是用 display: table-cell 来实现对齐，这样就能比较好的解决居中问题了。不过问题是不支持这种 display 的浏览器就会出问题，你可以考虑用 CSS hack 来 fallback，舍弃居中对齐来保持栅格系统正常工作。</textarea>
            </div>
            <div style="margin-top: 20px"><a class="btn btn-primary" href="feedBack.html">返回</a></div>
        </div>
        <div id="bg-models">
            <div id="bg-contents">
                <i class="glyphicon glyphicon-remove" id="btn-closed"></i>
                <div class="title_dialog">系统提示！</div>
                <div class="discription_dialog">确定已解决此条反馈了吗？</div>
                <div class="footer_dialog">
                    <button class="btn btn-primary" id="btn-ok">确定</button>
                    <button class="btn btn-primary" id="btn-off">取消</button>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(function () {
            $.ajax({
                type:"post",
                url:"{:U('Admin/Main/feedBackData')}",
                success: function (datas) {
                    if(datas == 'nodata') {
                        $("#dataList").html("暂时没有数据！");
                    }else{
                        options={
                            "id":"page",//显示页码的元素
                            "data":datas,//显示数据
                            "maxshowpageitem":2,//最多显示的页码个数
                            "pagelistcount":10,//每页显示数据个数
                            "callBack":function(data){
                                var str = '';
                                var txt = '';
                                for(var i=0;i<data.length;i++) {
                                    switch (data[i].type) {
                                        case '20':
                                            txt = '登陆问题';
                                            break;
                                        case '21':
                                            txt = '充值问题';
                                            break;
                                        case '22':
                                            txt = '游戏问题';
                                            break;
                                        case '0':
                                            txt = '其他原因';
                                            break;
                                        default:
                                            txt = '吐槽';
                                    }
                                    str += "<tr><td class='ids'>"+data[i].id+"</td><td>"+txt+"</td><td>"+data[i].uid+"</td><td>"+data[i].uname+"</td><td style='overflow-x: hidden;max-width: 140px;white-space: nowrap;text-overflow: ellipsis;-o-text-overflow: ellipsis'><a onclick='onClick(this)' title='"+data[i].content+"'>"+data[i].content+"</a></td><td>"+getLocalTime(data[i].add_time)+"</td><td><button class='btn btn-primary btn-sm' onclick='handel(this)'>确认已解决</button></td></tr>"
                                }
                                $("#dataList").html(str);
                            }
                        }
                        page.init(datas.length,1,options);
                    }
                }
            })
        });
        function onClick(This){
            $("#tabTab").hide();
            $("#panel").show();
            var ids = $(This).closest('tr').find('td.ids').text();
            $.ajax({
                type:"get",
                url:"{:U('Admin/Main/feedBackList')}?id=" + ids,
                success:function(data){
                    if(data == 'nodata') {
                        $("#panel").html("暂时没有任何数据！");
                    }else{
                        $("#ids").val(data.id);
                        $("#uidd").val(data.uid);
                        $("#classs").val(data.type);
                        $("#uname").val(data.uname);
                        $("#time").val(getLocalTime(data.add_time));
                        $("#contents").val(data.content);
                    }
                }
            });
        }
        function handel(This) {
            var ids = $(This).closest('tr').find('td.ids').text();
            $("#bg-models").fadeIn();
            $("#btn-ok").on("click",function () {
                $("#bg-models").hide();
                $.ajax({
                    type:"get",
                    url:"{:U('Admin/Main/feedBackPass')}?id=" + ids,
                    success:function (data) {
                        if(data == 'error') {
                            window.location.href="{:U('Admin/Main/feedBack')}";
                        }else if(data =='success'){
                            window.location.href="{:U('Admin/Main/feedBackLists')}";
                        }
                    }
                });
            });
            $("#btn-closed").on("click",function () {
                $("#bg-models").hide();
            });
            $("#btn-off").on("click",function () {
                $("#bg-models").hide();
            });
        }
    </script>
</body>
</html>